cCloseButton = {}
cCloseButton.Height = 16
cCloseButton.Width = 16
cCloseButton.X = 0
cCloseButton.Y = 0
cCloseButton.OnClick = nil
cCloseButton.Image = nil
cCloseButton.ImageSrc = "materials/gui/nonsense/close_16.tga"
cCloseButton.OnMouseUp = nil
cCloseButton.OnMouseDown = nil
cCloseButton.Visible = false

function cCloseButton:Init()	

end

function cCloseButton:SetVisible(bool)
	if not type(bool) == "boolean" then return end
	cCloseButton.Visible = bool
	gui.EnableScreenClicker( cMenu.Visible )
end

function cCloseButton:Paint()
	if cCloseButton.ImageSrc and cCloseButton.Visible then
		--if not cCloseButton.Image then
		--	cCloseButton.Image = vgui.Create( "TGAImage", self)  
		--	cCloseButton.Image:SetSize( cCloseButton.Width, cCloseButton.Height )  
		--	cCloseButton.Image:SetPos(0,0)  
		--	cCloseButton.Image:LoadTGAImage( cCloseButton.ImageSrc, "MOD" ); // Second argument should always be MOD.
		--	cCloseButton.Image.OnMouseDown = function() print("hi") end
		--end		
	end
	return true
end

function cCloseButton:SetImage(image)
	cCloseButton.ImageSrc = image
end

function cCloseButton:OnMousePressed( m )
	if ( self.OnMouseDown != nil ) then
		self.OnMouseDown( m );
	end
end

function cCloseButton:OnMouseReleased( m )
	if ( self.OnMouseUp != nil ) then
		self.OnMouseUp( m );
	end
end


vgui.Register("cCloseButton", cCloseButton, "Panel")